package cn.wuxing.mediation.system.service.impl;

import cn.wuxing.mediation.system.domain.QrlsbjStgDscHuzBiz029SjztjDfWxq;
import cn.wuxing.mediation.system.domain.StgDscHuzBiz018VisitPetitionDfWxq;
import cn.wuxing.mediation.system.domain.StgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq;
import cn.wuxing.mediation.system.domain.StgSxfjYgrxXfsjDfWxq;
import cn.wuxing.mediation.system.domain.vo.PetitionVo;
import cn.wuxing.mediation.system.mapper.PetitionMapper;
import cn.wuxing.mediation.system.mapper.QrlsbjStgDscHuzBiz029SjztjDfWxqMapper;
import cn.wuxing.mediation.system.service.IPetitionService;
import cn.wuxing.mediation.system.util.Desensitization;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 阳光信访
 */
@Service
public class IPetitionServiceImpl implements IPetitionService {

    @Resource
    private PetitionMapper petitionMapper;

    @Resource
    private QrlsbjStgDscHuzBiz029SjztjDfWxqMapper qrlsbjStgDscHuzBiz029SjztjDfWxqMapper;

    @Override
    public List<PetitionVo> selectAll(PetitionVo petitionVo) {
        return petitionMapper.selectAllMain(petitionVo);
    }

    @Override
    public List<PetitionVo> selectAllExport(PetitionVo petitionVo) {
        return petitionMapper.selectAllExport(petitionVo);
    }

    @Override
    public StgDscHuzBiz018VisitPetitionDfWxq selectStgDscHuzBiz018VisitPetitionDfWxq(String id) {
        StgDscHuzBiz018VisitPetitionDfWxq stgDscHuzBiz018VisitPetitionDfWxq = petitionMapper.selectStgDscHuzBiz018VisitPetitionDfWxq(id);
        String djjgmc = stgDscHuzBiz018VisitPetitionDfWxq.getDjjgmc();//登记机构名称
        if(null!=djjgmc){
            stgDscHuzBiz018VisitPetitionDfWxq.setDjjgmc(Desensitization.custNameDesensitization(djjgmc));
        }

        String yyr = stgDscHuzBiz018VisitPetitionDfWxq.getYyr();//扬言人
        if(null!=yyr){
            stgDscHuzBiz018VisitPetitionDfWxq.setYyr(Desensitization.desensitizedName(yyr));
        }

        String sqjgmc = stgDscHuzBiz018VisitPetitionDfWxq.getSqjgmc();//涉企机构名称
        if(null!=sqjgmc){
            stgDscHuzBiz018VisitPetitionDfWxq.setSqjgmc(Desensitization.custNameDesensitization(sqjgmc));
        }

        String sxr = stgDscHuzBiz018VisitPetitionDfWxq.getSxr();//受信人
        if(null!=sxr){
            stgDscHuzBiz018VisitPetitionDfWxq.setSxr(Desensitization.desensitizedName(sxr));
        }

        String xm = stgDscHuzBiz018VisitPetitionDfWxq.getXm();//姓名
        if(null!=xm){
            stgDscHuzBiz018VisitPetitionDfWxq.setXm(Desensitization.desensitizedName(xm));
        }

        String sjh = stgDscHuzBiz018VisitPetitionDfWxq.getSjh();//联系号码
        if(null!=sjh){
            stgDscHuzBiz018VisitPetitionDfWxq.setSjh(Desensitization.mobilePhoneDesensitization(sjh));
        }

        String sxjbjr = stgDscHuzBiz018VisitPetitionDfWxq.getSxjbjr();//事项件办结人
        if(null!=sxjbjr){
            stgDscHuzBiz018VisitPetitionDfWxq.setSxjbjr(Desensitization.desensitizedName(sxjbjr));
        }

        String calledphone = stgDscHuzBiz018VisitPetitionDfWxq.getCalledphone();//被叫号码
        if(null!=calledphone){
            stgDscHuzBiz018VisitPetitionDfWxq.setCalledphone(Desensitization.mobilePhoneDesensitization(calledphone));
        }

        String callphone = stgDscHuzBiz018VisitPetitionDfWxq.getCallphone();//来电号码
        if(null!=callphone){
            stgDscHuzBiz018VisitPetitionDfWxq.setCallphone(Desensitization.mobilePhoneDesensitization(callphone));
        }

        String djr = stgDscHuzBiz018VisitPetitionDfWxq.getDjr();//登记人
        if(null!=djr){
            stgDscHuzBiz018VisitPetitionDfWxq.setDjr(Desensitization.desensitizedName(djr));
        }

        String sdr = stgDscHuzBiz018VisitPetitionDfWxq.getSdr();//送达人
        if(null!=sdr){
            stgDscHuzBiz018VisitPetitionDfWxq.setSdr(Desensitization.desensitizedName(sdr));
        }

        return stgDscHuzBiz018VisitPetitionDfWxq;
    }

    @Override
    public StgSxfjYgrxXfsjDfWxq selectStgSxfjYgrxXfsjDfWxq(String id) {
        StgSxfjYgrxXfsjDfWxq stgSxfjYgrxXfsjDfWxq = petitionMapper.selectStgSxfjYgrxXfsjDfWxq(id);
        String phoneNum = stgSxfjYgrxXfsjDfWxq.getPhoneNum();//来电号码
        if(null!=phoneNum){
            stgSxfjYgrxXfsjDfWxq.setPhoneNum(Desensitization.mobilePhoneDesensitization(phoneNum));
        }
        return stgSxfjYgrxXfsjDfWxq;
    }

    @Override
    public StgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq selectStgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq(String id) {
        StgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq stgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq = petitionMapper.selectStgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq(id);
        String sxr = stgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq.getSxr();//受信人
        if(null!=sxr){
            stgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq.setSxr(Desensitization.desensitizedName(sxr));
        }
        String djr = stgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq.getDjr();//登记人
        if(null!=djr){
            stgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq.setDjr(Desensitization.desensitizedName(djr));
        }
        return stgSdsjjDscDa018Tab1010201ValidOldHuzDfWxq;
    }

    @Override
    public QrlsbjStgDscHuzBiz029SjztjDfWxq qrlsbjStgDscHuzBiz029SjztjDfWxq(String id) {
        QrlsbjStgDscHuzBiz029SjztjDfWxq qrlsbjStgDscHuzBiz029SjztjDfWxq = qrlsbjStgDscHuzBiz029SjztjDfWxqMapper.selectQrlsbjStgDscHuzBiz029SjztjDfWxqByAbz349(id);
        String abb703 = qrlsbjStgDscHuzBiz029SjztjDfWxq.getAbb703();//申请人
        if(null!=abb703){
            qrlsbjStgDscHuzBiz029SjztjDfWxq.setAbb703(Desensitization.desensitizedName(abb703));
        }

        String abb704 = qrlsbjStgDscHuzBiz029SjztjDfWxq.getAbb704();//被申请人
        if(null!=abb704){
            qrlsbjStgDscHuzBiz029SjztjDfWxq.setAbb704(Desensitization.desensitizedName(abb704));
        }

        String abb718 = qrlsbjStgDscHuzBiz029SjztjDfWxq.getAbb718();//登记人
        if(null!=abb718){
            qrlsbjStgDscHuzBiz029SjztjDfWxq.setAbb718(Desensitization.desensitizedName(abb718));
        }
        return qrlsbjStgDscHuzBiz029SjztjDfWxq;
    }
}
